package com.pdd.service.impl;

import com.pdd.beans.Order_detail;
import com.pdd.dao.Order_detailMapper;
import com.pdd.service.Order_detailService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单详情业务实现
 */
@Service
public class Order_detailerviceImpl implements Order_detailService {

    @Autowired
    @Setter
    private Order_detailMapper order_detailMapper;

    /**
     * 添加订单详情信息
     *
     * @param order_detail
     * @return
     */
    public boolean addOrder_detail(Order_detail order_detail) {
        return order_detailMapper.insertOrder_detail(order_detail)>0;
    }

    /**
     * 删除订单详情信息
     *
     * @param od_id
     * @return
     */
    public boolean delOrder_detail(int od_id) {
        return order_detailMapper.deleteOrder_detail(od_id)>0;
    }

    /**
     * 修改订单详情信息
     *
     * @param order_detail
     * @return
     */
    public boolean uplOrder_detail(Order_detail order_detail) {
        return order_detailMapper.updateOrder_detail(order_detail)>0;
    }

    /**
     * 查询所有订单详情信息
     *
     * @return
     */
    public List<Order_detail> getOrder_detail() {
        return order_detailMapper.selectOrder_detail();
    }

    /**
     * 根据订单ID查询订单详情信息
     *
     * @param o_id
     * @return
     */
    public Order_detail getById(int o_id) {
        return order_detailMapper.selectById(o_id);
    }
}
